#!/usr/bin/env bash
dt="`date -d "$d  0 days ago "  "+%Y-%m-%d"`"
mysql -ureadonly -preadonly123 -h192.168.0.49<<EOF
use jiayou;
select from_unixtime(created,'%Y-%m-%d')as day,coupon_title,count(id) from coupon_info
where tactics_type = 'score' and from_unixtime(created,'%Y-%m-%d')='$dt'
group by from_unixtime(created,'%Y-%m-%d'),coupon_title;
EOF